const {age, isNew, availableDescription, experience, currentCost, costDescription} = require('./utils.js')

module.exports = { 
	async parse(raw) {
        const person = { ...raw, age: age(raw.birthday), isNew: isNew(raw.createdDate) }
        const availability = { ...raw.availability, description: availableDescription(raw.availability.availableDate) }
        const profession = { ...raw.profession, experience: experience(raw.profession.professionStartDate) }
        const currentCostAmount = currentCost(raw.cost.plans)
        const cost = { ...raw.cost, amount: currentCostAmount, description: costDescription(currentCostAmount, raw.cost.unit) }
        return { ...person, availability, profession, projects: raw.projects, cost }
    }
}
